<template>
	<view id="app">
		<view class="container">
			<view class="comment">
				<view class="comment-list" v-for="(item,index) in comment" :key="index">
					<view class="comment-con">
						<view class="left">
							<uv-avatar size="100rpx" :src="item.user.avatar"></uv-avatar>
						</view>
						<view class="right">
							<view class="name">{{item.user.nickname}}</view>
							<view class="rows">
								<uv-rate :count="5" v-model="item.comment_rate"></uv-rate>
								<view class="f26 c666">{{item.create_time}}</view>
							</view>
						</view>
					</view>
					<view class="df fdc">
						<view class="c000 f28 ptb15">
							{{item.comment_remark}}
						</view>
						<view class="mtb20">
						<uv-album :urls="item.images" keyName="url" singleSize="660rpx" multipleSize="220rpx"  space="10rpx" :showMore="false"></uv-album>
						</view>
					</view>
					<view class="comment-back1" v-if="item.reply">
						{{member.name}}:{{item.reply}}
					</view>
					<view class="comment-back" v-if="item.reply_admin">
						平台回复:{{item.reply_admin}}
					</view>	
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	let that
	export default {
		data() {
			return {
				comment:[],
				page:1,
				more:true,
				nodata:true,
			}
		},
		onLoad(){
			that = this;
			that.getList();
		},
		onReachBottom(){
			if(that.more == false){
				return false;
			}
			that.getList();
		},
		methods: {
			getList:function(){
				let page = that.page
				this.request({
					url:"/api/user/comment",
					data:{id:this.member.id,page:page},
					success:function(res){
						if(res.code = 200){
							let map = res.data.map((item)=>{
								if(item.images){
									let img = item.images.split(',');
									for(let i=0;i<img.length;i++){
										let u =img[i];
										img.splice(i,1,Object.assign({url:u}));
									}
									item.images = img;
								}
								return item;
							})
						
							if(page == 1){
								that.comment = map;
								if(res.data.length == 0){
									that.nodata=false;
								}
							}else{
								that.comment.push(...map)
								
							}
							that.more = res.data.length < 10 ? false : true;
							that.page=page+1;
							console.log(that.comment);
						}
					}
				})
			},
			
		}
	}
</script>

<style>

</style>
